<template>
  <div class="search-history">
    <van-cell title="搜索历史">
      <span @click="onClearAllhistory">全部删除</span>
      <van-icon name="delete" />
    </van-cell>

    <van-cell
      v-for="item in searchHistorys"
      :title="item.searchKey"
      :key="item.id"
    >
      <van-icon name="close" @click="closeCurrent(item.id)" />
    </van-cell>
  </div>
</template>

<script>
export default {
  name: "SearchHistory",
  components: {},
  props: {
    searchHistorys: {
      type: Array,
      required: true
    },
    clearAllhistory: {
      type: Function,
      required: true
    },
    clearRowHistory: {
      type: Function,
      required: true
    }
  },
  data() {
    return {};
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    closeCurrent(id) {
      this.clearRowHistory(id)
    },
    onClearAllhistory() {
      this.clearAllhistory()
    }
  }
};
</script>

<style scoped lang="less">
</style>